package demisemapping;

public class Edge implements Comparable {
    Location a, b;
    int type;
    
    public Edge(Location a, Location b, int type) {
        this.a = a;
        this.b = b;
        this.type = type;
    }
    
    public String toString() {
        return a + " " + b + " " + type;
    }
    
    public int compareTo(Object obj) {
        assert(obj instanceof Edge);
        Edge o = (Edge) obj;
        if (a.compareTo(o.a) < 0) return -1;
        if (a.compareTo(o.a) > 0) return 1;
        if (b.compareTo(o.b) < 0) return -1;
        if (b.compareTo(o.b) > 0) return 1;
        return 0;
    }
}
